package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.FristProduct;
import cn.wolfcode.crm.mapper.FristProductMapper;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.service.IFristProductService;
import cn.wolfcode.crm.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
class FristProductServiceImpl implements IFristProductService {
    
    @Autowired
    private FristProductMapper fristProductMapper;
    
    @Override
    public int deleteByPrimaryKey(Long id) {
        return fristProductMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(FristProduct record) {
        return fristProductMapper.insert(record);
    }

    @Override
    public FristProduct selectByPrimaryKey(Long id) {
        return fristProductMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<FristProduct> selectAll() {
        return fristProductMapper.selectAll();
    }

    @Override
    public int updateByPrimaryKey(FristProduct record) {
        return fristProductMapper.updateByPrimaryKey(record);
    }

    @Override
    public PageResult query(QueryObject qo) {
        int total = fristProductMapper.queryForCount(qo);
        if (total == 0) {
            return new PageResult();
        }

        List list = fristProductMapper.queryForList(qo);
        return new PageResult(total, list);
    }
}
